package com.sxt.sys.controller;


import java.util.Map;
import com.sxt.springcloud.sys.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sxt.sys.common.DataGridView;
import com.sxt.sys.common.ResultObj;
import com.sxt.sys.vo.DeptVo;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 老雷
 * @since 2019-09-23
 */
@RestController
@RequestMapping("/dept")
public class DeptController {

	@Autowired
	private DeptClientService deptService;
	
	
	
	/**
	 * 加载部门管理左边的部门树的json
	 */
	@RequestMapping("loadDeptManagerLeftTreeJson")
	public DataGridView loadDeptManagerLeftTreeJson( DeptVo deptVo) {
		return this.deptService.loadDeptManagerLeftTreeJson(deptVo);
	}
	
	/**
	 * 查询
	 */
	@RequestMapping("loadAllDept")
	public DataGridView loadAllDept( DeptVo deptVo) {
		return this.deptService.loadAllDept(deptVo);
	}
	
	/**
	 * 加载最大的排序码
	 * @param
	 * @return
	 */
	@RequestMapping("loadDeptMaxOrderNum")
	public Map<String,Object> loadDeptMaxOrderNum(){
		return this.deptService.loadDeptMaxOrderNum();
	}
	
	
	/**
	 * 添加
	 * @param deptVo
	 * @return
	 */
	@RequestMapping("addDept")
	public ResultObj addDept( DeptVo deptVo) {
		return this.deptService.addDept(deptVo);
	}
	

	/**
	 * 修改
	 * @param deptVo
	 * @return
	 */
	@RequestMapping("updateDept")
	public ResultObj updateDept(DeptVo deptVo) {
		return this.deptService.updateDept(deptVo);
	}
	
	
	/**
	 * 查询当前的ID的部门有没有子部门
	 */
	@RequestMapping("checkDeptHasChildrenNode")
	public Map<String,Object> checkDeptHasChildrenNode( DeptVo deptVo){
		return this.deptService.checkDeptHasChildrenNode(deptVo);
	}
	
	/**
	 * 删除
	 * @param deptVo
	 * @return
	 */
	@RequestMapping("deleteDept")
	public ResultObj deleteDept( DeptVo deptVo) {
		return this.deptService.deleteDept(deptVo);
	}

	/**
	 * 加载门诊部门的树列表
	 */
	@RequestMapping("loadDetpForSelectById")
	public DataGridView loadDetpForSelectById() {
		return this.deptService.loadDetpForSelectById();
	}

}

